<template>
	<view class="demo">
		<p style="font-size: 4vw;color: #ccc;margin-top: 3vw;">实名认证后不可更改，请认真填写</p>
		<view class="demo_sm">
			<view class="sm">
				<view class="sm_left">
					真实姓名
				</view>
				<view class="sm_right">
					<input class="sm_inp" type="text" placeholder="本人真实姓名" v-model="inputsone" />
				</view>
			</view>
			<view class="sm">
				<view class="sm_left">
					身份证号
				</view>
				<view class="sm_right">
					<input class="sm_inp" type="text" placeholder="本人身份证号" v-model="inputstwo"/>
				</view>
			</view>
		</view>
		<p style="width: 90%;height: 5vw;display: flex;margin-top: 3vw;">
			<u-checkbox-group v-model="lists">
				<u-checkbox  activeColor="red" label=""></u-checkbox>
			</u-checkbox-group>
   同意《认证服务协议》</p>
		<button @click="boxs" style="width: 100%;height: 10vw;margin-top: 67vh;background-color: #075eb0;color: #ffffff;border-radius: 5vw;font-size: 4vw;">认证</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				lists:false,
				inputsone:"",
				inputstwo:'',
				checkboxList1:[
					{
					                    name: '',
					                    disabled: false
					                },
				]
			}
		},
	
		methods: {
			boxs(){
				console.log(this.lists)
				if(this.lists[0]==""){
					if(this.inputsone=="" && this.inputstwo==""){
						uni.showToast({
							title: "两者信息不能为空",
							icon: "none",
							duration: 2000
						})
					}else{
						let data={
							real_name:this.inputsone,
							id_card:this.inputstwo
						}
						uni.request({
							url:"/api/user/verify",
							method:"POST",
							header:{
								'content-Type': 'application/json',
								token: uni.getStorageSync('token')
							},
							data:data
						}).then(res=>{
							console.log(res)
							if(res.statusCode==200){
								wx.showToast({
								     title: '认证成功，正在返回个人中心',
								     icon: 'success',
								     duration: 2000//持续的时间
								   })
							let time=setInterval(()=>{
									
									uni.switchTab({
										url:"/pages/My/My"
									})
									clearInterval(time)
								},2000)
							}
						})
					}
				
					
				}else{
				uni.showToast({
					title: "请勾选认证服务协议",
					icon: "none",
					duration: 2000
				})
				}
				
			}
		}
	}
</script>

<style>
		.demo{
			width: 100vw;
			height: 100vh;
			background-color: #edf2fa;
			display: flex;
			flex-direction: column;
			align-items: center;
			overflow: scroll;
		}
		.demo_sm{
			width: 90%;
			height: 30vw;
			background-color: #ffffff;
			margin-top: 3vw;
			border-radius: 3vw;
		}
		.sm{
			width: 100%;
			height: 15vw;
			display: flex;
		}
		.sm_left{
			width: 30%;
			height: 100%;
			font-size: 4vw;
			text-align: center;
			line-height: 15vw;
		}
		.sm_right{
			width: 70%;
			height: 100%;
			font-size: 4vw;
		}
		.sm_inp{
			width: 100%;
			height: 100%;
		}
</style>
